from selenium import webdriver
import time

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys #键盘事件
from selenium.webdriver.support.select import Select #下拉菜单
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait #显式等待
from selenium.webdriver.support import expected_conditions as EC #预期判断条件的包


drivr= webdriver.Edge()
drivr.maximize_window()

drivr.get('https://www.jiuxian.com/')
time.sleep(10)

#显式等待
search=WebDriverWait(drivr,20,0.5).until(EC.presence_of_element_located((By.ID,'wd')))
search.send_keys('五粮液')

#隐式等待
drivr.implicitly_wait(5)
drivr.find_element(By.CLASS_NAME,'search-btn').click()


# 业务用例
# # 1.点击请登录
# drivr.find_element(By.LINK_TEXT,'请登录').click()
# time.sleep(2)
# #2.输入账号
# drivr.find_element(By.ID,'userName').send_keys('17733058407')
# time.sleep(2)
#
# #3.输入密码
# drivr.find_element(By.XPATH,'//*[@id="password"]').send_keys('Li10140910')
# time.sleep(20)
#
# #4.点击登录
# drivr.find_element(By.NAME,'bi_Usuallogin').click()
# time.sleep(2)
# # 6 点击 确定
# drivr.find_element(By.XPATH,'//a[@id="bindSub"]').click()
# time.sleep(2)
# # 校验点：hi，jxw543475854
# dy = drivr.find_element(By.XPATH,'/html/body/div[2]/div/div[1]/div/p/span').text
# print(dy)
# time.sleep(2)

time.sleep(15)
drivr.quit()

